package org.deschutter.hibernate;

import org.deschutter.hibernate.ActionType;
import org.deschutter.hibernate.Scans;

import javax.persistence.*;

/**
 * User: Berten De Schutter
 * Date: 01-Oct-2009
 * Time: 13:37:54
 */
@Entity
@Table(catalog = "scimitar", name = "actions")
public class Actions {
    private long id;

    @Id
    @Column(name = "ID")
    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    private String planetname;

    @Basic
    @Column(name = "planetname")
    public String getPlanetname() {
        return planetname;
    }

    public void setPlanetname(String planetname) {
        this.planetname = planetname;
    }

    private String rulername;

    @Basic
    @Column(name = "rulername")
    public String getRulername() {
        return rulername;
    }

    public void setRulername(String rulername) {
        this.rulername = rulername;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Actions actions = (Actions) o;

        if (id != actions.id) return false;
        if (planetname != null ? !planetname.equals(actions.planetname) : actions.planetname != null) return false;
        if (rulername != null ? !rulername.equals(actions.rulername) : actions.rulername != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = (int) (id ^ (id >>> 32));
        result = 31 * result + (planetname != null ? planetname.hashCode() : 0);
        result = 31 * result + (rulername != null ? rulername.hashCode() : 0);
        return result;
    }

    private ActionType actionTypeByTypeId;

    @ManyToOne
    @JoinColumn(name = "type_id", referencedColumnName = "ID")
    public ActionType getActionTypeByTypeId() {
        return actionTypeByTypeId;
    }

    public void setActionTypeByTypeId(ActionType actionTypeByTypeId) {
        this.actionTypeByTypeId = actionTypeByTypeId;
    }

    private Scans scansByScanId;

    @ManyToOne
    @JoinColumn(name = "scan_id", referencedColumnName = "ID")
    public Scans getScansByScanId() {
        return scansByScanId;
    }

    public void setScansByScanId(Scans scansByScanId) {
        this.scansByScanId = scansByScanId;
    }
}
